package 并发编程13.wait方式和park方式堵塞线程;

import java.util.concurrent.locks.LockSupport;

/**
 * @author idea
 * @data 2019/2/1
 */
public class Demo1 {

    public static void main(String[] args) {
        TestLockSupport testLockSupport=new TestLockSupport();
        testLockSupport.start();
    }
}

class TestLockSupport extends Thread {
    @Override
    public void run() {
        System.out.println( "TestLockSupport.run()" );
        //堵塞当前线程
        LockSupport.park();
    }
}
class TestThread extends Thread {
    @Override
    public void run() {
        System.out.println( "TestThread.run()" );
        synchronized (this) {
            try {
                wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

